package com.hyfrogx.modules.app.utils;

import com.hyfrogx.common.qcloud.GameUtils;
import com.hyfrogx.common.qcloud.QcloudApiModuleCenter;
import com.hyfrogx.common.qcloud.model.Vod;

import java.util.Random;
import java.util.TreeMap;

/**
 * @Author: Luo
 * @Date: 2019/11/18 10:28
 */
public class VodUtils {

    /**
     * 获取请求的配置参数
     * @return
     */
    public static QcloudApiModuleCenter getConfig() {
        TreeMap<String, Object> config = new TreeMap<String, Object>();
        config.put("SecretId", GameUtils.SecretId);
        config.put("SecretKey", GameUtils.StrSecKey);
        config.put("RequestMethod", "POST");
        config.put("DefaultRegion", "gz");
        return new QcloudApiModuleCenter(new Vod(), config);
    }

    /**
     * 获取公用字段参数对象
     * @param
     * @return
     */
    public static TreeMap<String, Object> getParam() {
        TreeMap<String, Object> params = new TreeMap<String, Object>();
        params.put("Region", "gz");
        Long time = System.currentTimeMillis() / 1000;
        params.put("Timestamp", time.toString());
        Integer nonce = new Random().nextInt(java.lang.Integer.MAX_VALUE);
        params.put("Nonce", nonce.toString());
        params.put("SecretId", GameUtils.SecretId);
        return params;
    }
}
